﻿using System;
using System.Collections.Generic;
using System.Text;

namespace homework2_bank.classes
{
    class BalanceArgs : UserAccount
    {
        private int LeftBalance { set; get; }
        private int CreditBalance { set; get; }

        public BalanceArgs(string account, string password, int leftBalance, int creditBalance)
            : base(account, password)
        {
            LeftBalance = leftBalance;
            CreditBalance = creditBalance;
        }

        public int GetLeftBalance()
        {
            return LeftBalance;
        }

        public int GetCreditBalance()
        {
            return CreditBalance;
        }

        public int MoneyOut(int num)
        {
            try
            {
                if (num > LeftBalance + CreditBalance)
                {
                    return -2;
                }
                else
                {
                    LeftBalance -= num;
                    return 0;
                }
            }
            catch (Exception e)
            {
                return -1;
            }
        }

        public bool MoneyIn(int num)
        {
            LeftBalance += num;
            return true;
        }
    }
}
